/* 
 * File:   MainProcessQuitHandler.h
 * Author: dell
 *
 * Created on 2012年4月9日, 下午3:12
 */

#ifndef MAINPROCESSQUITHANDLER_H
#define	MAINPROCESSQUITHANDLER_H

#include "common.h"
#include "ProcessQuitSignal.h"
#include <evhttp/events.h>

namespace Rapid{
    class MainProcessQuitHandler : public ProcessQuitSignal{
    public:
        MainProcessQuitHandler(RapidServer* rapidServer);
        virtual ~MainProcessQuitHandler();

    protected:  
        bool onProcessSignalEvent(const ProcessSignalEvent* e);
        bool onTimerEvent(const TimerEvent* e);
                
    private:
        void executeClose();
        void notifyClose();
        bool isClosed();        
        
    private:
        RapidServer* rapidServer;
        int repeat;
    };
}
#endif	/* MAINPROCESSQUITHANDLER_H */

